package org.example.scenicspot.controller;

import org.example.scenicspot.domain.Staff;
import org.example.scenicspot.service.staffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/")

public class staffController {
    @Autowired
    private staffService staffservice;
    @GetMapping("/staff")
    public List<Staff> showstaff(){
        return staffservice.showstaff();
    }

    @GetMapping ("/searchstaff")
    public List<Staff> searchstaff(String keyword){
        return staffservice.searchstaff(keyword);
    }

    @GetMapping ("/selectstaffbyscenicareaid")
    public List<Staff> selectStaffByScenicAreaID(int scenicareaid){
        return staffservice.selectByScenicAreaID(scenicareaid);
    }

    @GetMapping ("/deletestaff")
    public void deletestaff(int id){
        staffservice.deletestaff(id);
    }

    @PostMapping("/insertstaff")
    public void insertstaff(@RequestBody Staff staff){
        staffservice.insertstaff(staff);
    }

    @PostMapping ("/updatestaff")
    public void updatestaff(@RequestBody Staff staff){
        staffservice.updatestaff(staff);
    }


}
